package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 服务项接口
 */
@Slf4j
@RestController
@Api(tags = "服务项接口")
@RequestMapping("/customer/orders/project")
public class CustomerProjectController extends BaseController {
    @Autowired
    NursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目列表
     * @param name
     * @param pageNum
     * @param pageSize
     * @param status
     * @return
     */
    @ApiOperation("分页查询护理项目列表")
    @GetMapping("/page")
    public ResponseResult<NursingProjectVo> list(String name, Integer pageNum, Integer pageSize, Integer status) {
        log.info("分页查询护理项目列表: {},{},{},{}",name,pageNum,pageSize,status);
        // 调用nursingProjectService分页查询护理项目列表
        PageResponse<NursingProjectVo> pageResponse = nursingProjectService.list(name, pageNum, pageSize, status);
        return success(pageResponse);
    }

    /**
     * 根据id查询护理项目信息
     * @param id
     * @return
     */
    @ApiOperation("根据id查询护理项目信息")
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> getById(@PathVariable Long id) {
        log.info("根据id查询护理项目信息: {}",id);
        // 调用nursingProjectService根据id查询护理项目信息
        NursingProjectVo nursingProjectVo = nursingProjectService.getById(id);
        return success(nursingProjectVo);
    }
}
